package com.itheima.polymorpic.practice02;

public class Test1Polymorphic {
    public static void main(String[] args) {
        Animal animal = new Dog();
        animal.eat();
        Animal animal1 = new Cat();
        animal1.eat();
    }
}
class  Animal{
    public void eat(){
        System.out.println("动物吃饭");
    }
}
class Cat extends  Animal{
    @Override
    public void eat() {
        System.out.println("猫吃鱼");
    }
}
class Dog extends  Animal{
    @Override
    public void eat() {
        System.out.println("狗吃肉");
    }
}